var mongoose = require("mongoose");

//回答表(answer)

var answerSchema = new mongoose.Schema({
  selected: {
    type: String,
  }, //精选
  content: {
    type: String,
    required: true
  }, //富文本内容
  userid: {
    type: mongoose.SchemaTypes.ObjectId,
    ref: "user_login",
    required: true
  }, //用户id
  release_time: {
    type: Date,
    default: new Date()
  }, //发布时间
  adopt: {
    type: Number,
    default: 0
  }, //采纳 0无采纳 1采纳
  topping: {
    type: Number,
    default: 0
  }, //置顶 置顶 1无置顶
  reply: {
    type: Number,
    default: 0
  }, //回复量
  praise: {
    type: Array,
    default: []
  }, //赞量
  praiseSize: {
    type: Number,
    default: 0
  }, //赞量
  audit: {
    type: Boolean,
    default: true
  }, //审核
  problem_id: {
    type: mongoose.SchemaTypes.ObjectId,
    ref: "problem",
    required: true
  }, //问题id
  textReplace: {
    type: String
  }
});

module.exports = mongoose.model("answer", answerSchema);